﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using TrilhaImovel.Core.Entities;
using SharpArch.Data.NHibernate;
using TrilhaImovel.Core.Repositories;
using NHibernate;
using NHibernate.Criterion;

namespace TrilhaImovel.Data
{
    public class GeocodingLogRepository : Repository<GeocodingLog>, IGeocodingLogRepository
    {
        #region IGeocodingLogRepository Members

        public GeocodingLog GetGeocodinglog(int year, int month, int day)
        {
            ICriteria criteria =
                Session.CreateCriteria(typeof(GeocodingLog))
                    .Add(Expression.Eq("DayOfUse", new DateTime(year, month, day, 0, 0, 0)));

            return criteria.List<GeocodingLog>().SingleOrDefault<GeocodingLog>();
        }

        #endregion
    }
}
